// pages/home/home.js
let app = getApp();

Page({

  /**
   * 页面的初始数据
   */
  data: {
      navigationBarTitle:'校园小助手',
      scrollLeft:0,
      TabCur: 0,
      scrollBarItem:[
        {
          title:'寻物启事',
        
        },
        {
          title:'失物招领',
        },
        {
          title:'答疑解惑',
        },
        {
          title:'畅所欲言',
        
        },
        {
          title:'跳蚤市场',
  
        }
      ]

  },
  tabSelect(e) {
    this.setData({
      TabCur: e.currentTarget.dataset.id,
      scrollLeft: (e.currentTarget.dataset.id-1)*60
    })
  },


  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    if (typeof this.getTabBar === 'function' && this.getTabBar()) {
      this.getTabBar().setData({
          selected: 0  //数字是当前页面在tabbar的索引
      })
   }
 
  },

  onReady(){
    setTimeout(() => {
      let height = app.globalData.screenHeight-app.globalData.CustomBar-app.globalData.tabbarHeight
      let tabHeight = app.globalData.tabbarHeight;
      this.setData({
        height,
        tabHeight
      })
      app.globalData.container = height;
    }, 300);
    
    // app.globalData.container = height;
    
  }
})